from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from models import Poll

class ChoiceInline(admin.TabularInline):
	model = Choice
	extra = 3

class PollAdmin(admin.ModelAdmin):
	fieldsets = ((None, {'fields': ('site', 'user', 'title', 'slug',)}),
	    	(_(u'Tagging'), {'fields': ('tags',),}),
            (_(u'Date information'), {'fields': ('pub_date',), 
		                  'classes': 'collapse'}),
            (_(u'Settings'), {'fields': ('publication_status',)}),
	)
	list_display = ('title', 'pub_date', 'site', 'user', 'publication_status',)
	list_filter = ('pub_date', 'site', 'user', 'publication_status',)
	search_fields = ['title']
	date_hierarchy = 'pub_date'
	prepopulated_fields = {'slug': ('title',)}
	radio_fields = {'publication_status': True}
	inlines = [ChoiceInline]
    
admin.site.register(Poll, PollAdmin)